package com.glory.erp.auth.dept.dao.impl;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.glory.erp.auth.base.BaseDaoImpl;
import com.glory.erp.auth.base.BaseQueryModel;
import com.glory.erp.auth.dept.bean.Dept;
import com.glory.erp.auth.dept.bean.DeptQuery;
import com.glory.erp.auth.dept.dao.DeptDao;

public class DeptDaoImpl extends BaseDaoImpl<Dept> implements DeptDao {

	public void doQbc(DetachedCriteria dc, BaseQueryModel qm) {
		DeptQuery deptQuery = (DeptQuery) qm;
		if (deptQuery.getName() != null
				&& deptQuery.getName().trim().length() > 0) {
			dc.add(Restrictions.like("name", "%" + deptQuery.getName().trim()
					+ "%"));
		}
		if (deptQuery.getTele() != null
				&& deptQuery.getTele().trim().length() > 0) {
			dc.add(Restrictions.like("tele", "%" + deptQuery.getTele().trim()
					+ "%"));
		}
	}
}